package it.gma.torero.operator;

import it.gma.torero.operand.Operand;
import it.gma.torero.operand.VariableBinder;


/**
 * <a href="http://en.wikipedia.org/wiki/Logical_consequence">Logical
 * consequence</a> (also entailment) is one of the most fundamental concepts in
 * logic. It is the relationship between statements that holds true when one
 * logically "follows from" one or more others. Valid logical arguments are ones
 * in which the conclusions follow from its premises, and its conclusions are
 * consequences of its premises. The philosophical analysis of logical
 * consequence involves asking, 'in what sense does a conclusion follow from its
 * premises' and 'what does it mean for a conclusion to be a consequence of
 * premises' All of philosophical logic can be thought of as providing accounts
 * of the nature of logical consequence, as well as logical truth.
 * 
 * 
 * 
 * @author giordano
 * 
 */
public class ImplicationOperator extends AbstractBooleanOperator {

	OrOperator orOperator;
	
	public ImplicationOperator(Operand operand1, Operand operand2) {
		super(operand1, operand2);
		orOperator = new OrOperator(new NotOperator(operand1), operand2);
	}

	public boolean evaluate() {
		return orOperator.evaluate();
	}
	
	
	@Override
	public String toString() {
		return "(" + operand1 + " --> " + operand2 + ")";
	}

	
	
	@Override
	public void setContext(VariableBinder context) {
		super.setContext(context);
		orOperator.setContext(context);
	}
}
